package com.liu.demo2.Service.iml;

import com.liu.demo2.Service.UserService;
import com.liu.demo2.U.User;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;

@Service
public class UserServiceIml implements UserService {
    //    @Autowired
    JdbcTemplate jdbcTemplate;

    public UserServiceIml(JdbcTemplate jdbcTemplate) {
        this.jdbcTemplate = jdbcTemplate;
    }

    @Override
    public int addUser(User user) {
        String sql = "insert into user (Username, Password) values (?,?)";
        return jdbcTemplate.update(sql, user.getUsername(), user.getPassword());
    }

    @Override
    public int updateUser(User user) {
        return 0;
    }

    @Override
    public int deleteUser(User user) {
        return 0;
    }

    @Override
    public User findUser(User user) {
        return null;
    }
}
